package org.example.basic.day03;


import java.util.Arrays;
import java.util.List;

/**
 * 抽象类
 */
public class Demo抽象类练习1 {
    public static void main(String[] args) {
       method(new ExcelDataExport(),Arrays.asList("1","2","3"),"report.xlsx");
       method(new PdfDataExport(),Arrays.asList("1","2","3"),"bianshen.pdf");
    }
    public  static void method(DataExport dataExport,List<String> data,String filename){
        byte[] bytes= dataExport.exportData(data);
        dataExport.savaToFile(data,filename);
    }
}
abstract class DataExport{
    public abstract  byte[] exportData(List<String>  data);
    public void savaToFile(List<String> data,String fileName){
        System.out.println("保存到："+fileName+"文件中");
    }
}

class ExcelDataExport extends DataExport{
    @Override
    public byte[] exportData(List<String> data) {
        System.out.println("导出数据到Excel文件");
        return new byte[0];
    }

}
class PdfDataExport extends DataExport{
    @Override
    public byte[] exportData(List<String> data) {
        System.out.println("导出数据到Pdf文件");
        return new byte[0];
    }
}
